package com.link.linkupjavaweb.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.link.linkupjavaweb.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 用户Mapper接口
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    
    /**
     * 根据账号或手机号查询用户
     */
    @Select("SELECT * FROM tb_user WHERE account = #{accountOrPhone} OR phone = #{accountOrPhone}")
    User selectByAccountOrPhone(@Param("accountOrPhone") String accountOrPhone);
    
    /**
     * 根据手机号查询用户
     */
    @Select("SELECT * FROM tb_user WHERE phone = #{phone}")
    User selectByPhone(@Param("phone") String phone);
    
    /**
     * 根据账号查询用户
     */
    @Select("SELECT * FROM tb_user WHERE account = #{account}")
    User selectByAccount(@Param("account") String account);
}

